package com.unisound.tracelog.client.core.model;

import com.unisound.tracelog.client.core.support.parameter.ParameterValue;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

public class StartSpan {
    /**
     * 方法名称(尽量使用中文描述)
     */
    private String name;

    /**
     * 服务名称(尽量使用缩写 如:ETL)
     */
    private String serverName;

    private Integer type = 0;

    /**
     * 方法参数
     */
    private Map<String, ParameterValue> parameterMap;

    public StartSpan() {
    }

    public StartSpan(String name, String serverName, Map<String, ParameterValue> parameterMap) {
        this.name = StringUtils.trimToNull(name);
        this.serverName = StringUtils.trimToNull(serverName);
        this.parameterMap = parameterMap;
    }

    public StartSpan(String name, String serverName, Integer type, Map<String, ParameterValue> parameterMap) {
        this.name = StringUtils.trimToNull(name);
        this.serverName = StringUtils.trimToNull(serverName);
        this.type = type;
        this.parameterMap = parameterMap;
    }

    public StartSpan(String name, String serverName) {
        this.name = StringUtils.trimToNull(name);
        this.serverName = StringUtils.trimToNull(serverName);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = StringUtils.trimToNull(name);
    }

    public String getServerName() {
        return serverName;
    }

    public void setServerName(String serverName) {
        this.serverName = StringUtils.trimToNull(serverName);
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Map<String, ParameterValue> getParameterMap() {
        return parameterMap;
    }

    public void setParameterMap(Map<String, ParameterValue> parameterMap) {
        this.parameterMap = parameterMap;
    }
}
